<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.fick.hibernate.model.*"%>
<%@ page import="com.fick.hibernate.dao.*"%>
<%@ page import="com.fick.util.Pager" %>
<%@ include file="../tld/tlds.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>信息排行情况查询</title>
<link href="images/jiahao.css" rel="stylesheet" type="text/css">

		<link href="css/css.css" rel="stylesheet" type="text/css" />
		<script language="JavaScript" src="js/meihuaxue.js"></script>
		<script language="javaScript" src="js/prototype.js"></script>
		<script type="text/javascript" src="js/submit.js"></script>
	<script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>	
</head>
<body>
<%
	NewsDAO newsdao=new NewsDAO();
	String qsrq=request.getParameter("qsrq");
	String zzrq=request.getParameter("jsrq");
	String hql="";
	int currPage=1;
	int totalCount=0;
	int totalPage=0;
	int pageSize=10;
	List li2=null;
	String QueryString="";      //查询条件
	if(qsrq !=null && !qsrq.equals("") && zzrq !=null && !zzrq.equals(""))
	{
		hql=hql.equals("")?hql+" where ":hql+" and ";
		hql=hql+"addDate>='"+qsrq+" 00:00:00' and addDate<='"+zzrq+" 23:59:59' and isAss=1";
		QueryString=QueryString+"&qsrq="+qsrq+"&jsrq="+zzrq+"&";
	}
	if(!hql.equals(""))
	{
		totalCount=newsdao.count(News.class,hql);
		totalPage=totalCount%2==0?totalCount/pageSize:(totalCount/pageSize)+1;
		if(request.getParameter("currPage")!=null)
		{
			currPage=Integer.parseInt(request.getParameter("currPage"));
		}
		li2=newsdao.findPageBySql(News.class,currPage,10,hql);
	}
 %>
<table width="100%"  height="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="100%" align="center" valign="top" background="images/main_bj.gif" bgcolor="#FBFCFD"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="23" align="left" valign="middle" background="images/main_top.gif"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="20" height="23">&nbsp;</td>
            <td width="400" height="23" align="left" valign="middle" class="ts_lmdh2">排行信息情况查询 </td>
          </tr>
        </table></td>
      </tr>
    </table>
<form action="newsSearch.jsp" method="post">
<table align="center" width="100%">
	<tr>
		<td align="center"><font color="red">所属单位：</font>
			<select name="unit">
			<option value="">请选择</option>
			<%List<Object []> list=new AdminDAO().findBySql("SELECT admin_id,unit FROM admin WHERE (adminName <> 'fick707superadmin')");
			for(Object[] result:list){%>
			<option value="<%=result[0]%>"><%=result[1]%></option>
			<%}%>
			</select>
		
		起始时间：<input id="qsrq" type="text" name="qsrq"/><img onclick="WdatePicker({el:'qsrq'})" src="../admin/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="middle">
	 	结束时间：<input id="jsrq" type="text" name="jsrq"/><img onclick="WdatePicker({el:'jsrq'})" src="../admin/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="middle">
		<input type="submit" value="查询"></td>
	</tr>
</table>
</form>
	  <table>
			<tr><td><font size="2" color="red">
			<%
			if(qsrq !=null && zzrq!=null && !"".equals(qsrq) && !"".equals(zzrq)){
				out.print("从"+qsrq+"到"+zzrq+"共发布了"+totalCount+"篇");
			}%>
			
	  </table>
      <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D7DFE1">
        <tr>
		 <td width="6%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">选择</td>
          <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">信息标题</td>
		  <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">所属栏目</td>
          <td width="15%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">信息发布日期</td>
          <td width="20%" height="25" align="center" valign="middle" background="images/main_t_bj.gif" bgcolor="#FFFFFF" class="ts_lmdh">操作</td>
        </tr>
	   <%
	   if(li2!=null)
	   {
		for(int i = 0 ; i < li2.size(); i++){
			News news=(News)li2.get(i);
	 %>
	    <tr>
		<td width="6%" height="25" align="center" valign="middle" bgcolor="#FFFFFF">
		<input type="checkbox" name="MyCheckBox" id="MyCheckBox"
													value="<%=news.getNewId()%>" />
		</td>
          <td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=news.getTitle()%>
		  </td>
		   <td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=news.getChannelid().getName()%>
		  </td>
		  <td width="15%" height="25" align="center" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <%=news.getAddDate().toLocaleString()%>
		  </td>
	  		<td width="20%" height="25" align="center" valign="middle" bgcolor="#FFFFFF">
				<a href="/userSites/signLogin.jsp?newsId=<%=news.getNewId()%>">查看</a>
			</td>
        </tr>
      <%
	  }
	  }
	  %>
	  </table>
	  <table width="98%" align="center" border="0" cellspacing="0" cellpadding="0">
		  	<tr><td align="center"><%=new Pager().nprintTable("newsSearch.jsp?",currPage,totalPage,totalCount,QueryString,QueryString)%></td></tr>
	  </table>
      </td>
  </tr>
</table>
</body>
</html>
 <script type="text/javascript">
  function gopage(selected)
	 {
	 	window.open(selected.value,"_self");
	 }
 </script>
  <%--
<!--
var message = "<%=session.getAttribute("message")%>";
if(message!=null && message!="null" && message !=""){
   alert(message);
  }
  
 function gopage(selected)
 {
 	window.open(selected.value,"_self");
 }
//-->
</script>
<%
	session.removeAttribute("message");
%>--%>
